package com.klb.model;

import javax.persistence.*;

/**
 * Created by fujia on 2016/7/2.
 */
@Entity
@Table(name = "bbs_admin", schema = "knowlogebase", catalog = "")
public class BbsAdmin {
    private int adminId;
    private String username;
    private String password;
    private String salt;

    @Id
    @Column(name = "admin_id", nullable = false)
    public int getAdminId() {
        return adminId;
    }

    public void setAdminId(int adminId) {
        this.adminId = adminId;
    }

    @Basic
    @Column(name = "username", nullable = false, length = 32)
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Basic
    @Column(name = "password", nullable = false, length = 100)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "salt", nullable = false, length = 50)
    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;

        BbsAdmin bbsAdmin = (BbsAdmin) object;

        if (adminId != bbsAdmin.adminId) return false;
        if (username != null ? !username.equals(bbsAdmin.username) : bbsAdmin.username != null) return false;
        if (password != null ? !password.equals(bbsAdmin.password) : bbsAdmin.password != null) return false;
        if (salt != null ? !salt.equals(bbsAdmin.salt) : bbsAdmin.salt != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = adminId;
        result = 31 * result + (username != null ? username.hashCode() : 0);
        result = 31 * result + (password != null ? password.hashCode() : 0);
        result = 31 * result + (salt != null ? salt.hashCode() : 0);
        return result;
    }
}
